#!/usr/bin/python
#coding: utf-8

import multiprocessing as mp
from multiprocessing import Manager as m

class Multi(object):
    def __init__(self):
        self.res = set(range(10))

    def test(self):
        print self.res
        m = mp.Manager()
        value = m.list(list(self.res))
        cpu_count = mp.cpu_count()
        while len(mp.active_children()) < cpu_count and value:
            p = mp.Process(target= self.crawler, name= "multiprocessing", args=(value, ))
            p.start()
            p.join()

    def crawler(self, value):
        if value:
            print value.pop()
            print value

if __name__ == "__main__":
    m = Multi()
    m.test()